﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Soundteller.Common.Tests;
using Soundteller.Visual.Model;
using System.Collections.Generic;

namespace Soundteller.AudioVisual.Tests.Unit.Services.SoundtellerDrawerSpecifications
{
    [TestClass]
    public class WhenDrawGivenSoundtellerGraphicNotFound : SoundtellerDrawerTestBase
    {
        protected override void Act()
        {
            ExpectException(() => base.Act());
        }

        [TestMethod]
        public void ThenAnInvalidOperationExceptionShouldBeThrown()
        {
            Exception.VerifyInvalidOperationException("Cannot draw pad surface, graphics not found");
        }
    }

    [TestClass]
    public class WhenDraw : SoundtellerDrawerTestBase
    {
        protected override void Arrange()
        {
            base.Arrange();
            GraphicRepository.Setup(r => r.GetByCategory(It.IsAny<string>())).Returns(new List<GraphicBase> { new GeneratedGraphic() });
        }

        [TestMethod]
        public void ThenSurfaceShouldBeDrawn()
        {
            Drawer.Verify(d => d.Draw(It.IsAny<List<GraphicBase>>()), Times.Once());
        }
    }
}
